<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: wsh
 * @Date: 2023-06-20 10:13:27
 * @LastEditors: wsh
 * @LastEditTime: 2023-06-20 10:19:33
-->
<template>
  <BaseContainer>
    <aplid-base-crud ref="crud" class="w-100" :paramsObj="{taskId:props.taskId}" v-bind="theConfig">
      <template v-slot:DetailDialog="{ row, show }">
        <Detail
          @rechange="handleOperate"
          @refresh="handleRefresh"
          :api="theConfig.api"
          :key="show"
          :nowRowData="row">
        </Detail>
      </template>
    </aplid-base-crud>
  </BaseContainer>
</template>

<script setup lang="ts">
import { ref,nextTick } from 'vue'
import { baseConfig } from './config'
import Detail from './detail/index.vue'
type Props = {
  taskId?:any
  isView?:any
}
let props = withDefaults(defineProps<Props>(),{
  taskId:undefined,
  isView:false
})
let theConfig:any = ref({})
let copyBaseConfig = JSON.parse(JSON.stringify(baseConfig))
if(props.isView){
  copyBaseConfig.searchConfig.column =  copyBaseConfig.searchConfig.column.filter(el=>{
    return el.prop!='examineType'&&el.prop!='taskName'
  })
  theConfig.value = copyBaseConfig
}else{
  theConfig.value = baseConfig
}


const crud = ref()
const handleRefresh = () => {
  nextTick(() => {
    crud.value.refreshChange()
  })
}

const handleOperate = (type, row, title) => {
  nextTick(() => {
    crud.value.handleOperate(type, row, title)
  })
}

</script>

<style scoped></style>